import { Context } from "koa";

const db = require('../../utils/db');
class desktopController {
  async index(ctx: Context): Promise<any> {
    ctx.body = 'desktopController---desktop的根路径'
  }

  async getImgList(ctx: Context): Promise<any> {
    //访问数据库，拿到数据返给前端
    let myData = await new Promise((resolve, reject) => {
      return db.query(`select * from assets_img`, (error: any, data: any) => {
        if (error) throw error;
        resolve(data);
      });
    });

    ctx.body = myData;
  }
}
export default new desktopController